{
unsigned long va;
unsigned int idx, i, flags, vcpu = current->vcpu_id;
- struct mapcache *cache = ¤t->domain->arch.mapcache;
+ struct domain *d;
+ struct mapcache *cache;
#ifndef NDEBUG
unsigned int flush_count = 0;
#endif
perfc_incrc(map_domain_page_count);
/* If we are the idle domain, ensure that we run on our own page tables. */
- if ( unlikely(is_idle_vcpu(current)) )
+ d = current->domain;
+ if ( unlikely(is_idle_domain(d)) )
__sync_lazy_execstate();
+ cache = &d->arch.mapcache;
+
spin_lock(&cache->lock);
/* Has some other CPU caused a wrap? We must flush if so. */
- if ( cache->epoch != cache->shadow_epoch[vcpu] )
+ if ( unlikely(cache->epoch != cache->shadow_epoch[vcpu]) )
{
- perfc_incrc(domain_page_tlb_flush);
- local_flush_tlb();
cache->shadow_epoch[vcpu] = cache->epoch;
+ if ( NEED_FLUSH(tlbflush_time[smp_processor_id()],
+ cache->tlbflush_timestamp) )
+ {
+ perfc_incrc(domain_page_tlb_flush);
+ local_flush_tlb();
+ }
}
do {
perfc_incrc(domain_page_tlb_flush);
local_flush_tlb();
cache->shadow_epoch[vcpu] = ++cache->epoch;
+ cache->tlbflush_timestamp = tlbflush_current_time();
}
flags = 0;
/*
* Maps a given range of page frames, returning the mapped virtual address. The
- * pages are now accessible within the current domain until a corresponding
+ * pages are now accessible within the current VCPU until a corresponding
* call to unmap_domain_page().
*/
extern void *map_domain_pages(unsigned long pfn, unsigned int order);
/*
* Pass a VA within the first page of a range previously mapped in the context
- * of the currently-executing domain via a call to map_domain_pages(). Those
+ * of the currently-executing VCPU via a call to map_domain_pages(). Those
* pages will then be removed from the mapping lists.
*/
extern void unmap_domain_pages(void *va, unsigned int order);
/*
* Similar to the above calls, except the mapping is accessible in all
- * address spaces (not just within the domain that created the mapping). Global
+ * address spaces (not just within the VCPU that created the mapping). Global
* mappings can also be unmapped from any context.
*/
extern void *map_domain_page_global(unsigned long pfn);